Skip to content

feat(ai): custom providers/profiles, agent skills/tools, and MCP foundation - #415

Open
NabinSharmaitgithub wants to merge 6 commits into
AndroidCSOfficial:devfrom
NabinSharmaitgithub:feature/custom-ai-provider
Open

NabinSharmaitgithub wants to merge 6 commits into
AndroidCSOfficial:devfrom
NabinSharmaitgithub:feature/custom-ai-provider

Conversation

@NabinSharmaitgithub

@NabinSharmaitgithub NabinSharmaitgithub commented Nov 7, 2026 •

Copy link
Copy Markdown

Summary

Implements the requested AI agent enhancements in GitHub for Android Code Studio (AI Agent).

Delivered (all requested items)

  • Custom provider support (OpenAI-compatible): configurable base URL + model + optional bearer API key, active profile selection, legacy single-config migration.
  • Multiple saved custom providers/profiles: create/select/edit/delete custom endpoint profiles.
  • MCP client support (Android app AI agent foundation): HTTP JSON-RPC MCP client with basic Streamable HTTP compatibility (Mcp-Session-Id, MCP-Protocol-Version), JSON/SSE and 202/204 handling, MCP server management UI, and prebuilt presets/templates: GitHub, Firebase, Stitch, Vercel, Cloudflare, Supabase (superbase), Custom MCP (disabled by default; user configures URL/auth).
  • Agent skills/tools/capabilities: built-in tools (read_file, list_files, search_project, get_project_tree, modify_file, gated run_command), per-tool enable/disable in agent profiles, MCP tool discovery/calls, and a bounded agent tool loop.
  • Native tool/function-calling (all providers): AIAgent extended with optional native tool API (backward-compatible defaults). AIAgentManager prefers native tool calls when supported, with text-protocol fallback (TOOL_CALL/TOOL_RESULT). Native implementations added for Custom, Local LLM, OpenAI, DeepSeek, Grok, Anthropic, Gemini.
  • Reusable prompt/agent profiles: saved profiles with system instructions + tool/MCP toggles + per-tool disables. Prebuilt skills: File Reader, Command Run (opt-in), File Modification, Stitch Skill, Design Skill, Custom Skill.
  • UI: AI Preferences adds Agent Profiles & Skills and MCP Servers; custom provider dialog supports multiple profiles.

Key files

  • AIAgent.kt, AIAgentManager.kt — native/text tool loop, provider-agnostic tool execution
  • tools/AITools.kt, tools/OpenAICompatNative.kt — tool defs/protocol, built-in executor, OpenAI-compatible native helper
  • profiles/AgentPromptProfile.kt, profiles/CustomProviderProfile.kt — profiles, skill presets, per-tool toggles, migration
  • mcp/McpClient.kt, mcp/McpModels.kt — MCP client/presets
  • dialogs/AgentProfilesDialog.kt, dialogs/McpServersDialog.kt, dialogs/CustomProviderConfigDialog.kt — management UI
  • agents/{custom,local,openai,deepseek,grok,anthropic,google}/* — provider integration + native tool calling

Notes / caveats

  • Not built/tested in this environment (Android/Gradle build not executed here). Please run CI/build verification.
  • MCP presets are templates; remote MCP endpoints/auth requirements vary by service and may need server-specific adjustment.
  • run_command is opt-in and gated by the active agent profile (allowCommandExecution).
  • Gemini native tools use the REST generateContent function-calling format (not SDK Tool objects) to avoid SDK-version coupling; existing SDK generateCode path remains for non-tool requests.

Target base: dev (from fork NabinSharmaitgithub/android-code-studio:feature/custom-ai-provider)

Adds a configurable custom provider for the AI Agent:
- New CustomProvider (OpenAI-compatible chat completions endpoint)
- Configurable base URL, model name, and optional API key
- Settings UI entries and sidebar configuration dialog
- Registered in agent manager, model/provider selection, and API key helpers
…P foundation

- Multiple saved custom OpenAI-compatible provider profiles (add/edit/delete/activate) with legacy migration
- Reusable agent prompt profiles + prebuilt skills (file reader, command run [opt-in], file modification, Stitch, design, custom)
- Built-in agent tools/capabilities (read_file, list_files, search_project, get_project_tree, modify_file, run_command gated)
- MCP client foundation (HTTP JSON-RPC/SSE-compatible), server config storage, and prebuilt MCP presets (GitHub, Firebase, Stitch, Vercel, Cloudflare, Supabase, custom)
- Agent loop integration in AIAgentManager for text-based TOOL_CALL/TOOL_RESULT
- Sidebar AI Preferences UI for agent profiles and MCP servers
@NabinSharmaitgithub NabinSharmaitgithub changed the title feat(ai): add custom OpenAI-compatible provider support feat(ai): custom providers/profiles, agent skills/tools, and MCP foundation Nov 7, 2026
…mable HTTP headers

- Extend AIAgent with optional native tool-calling API (backward compatible defaults)
- AIAgentManager prefers native tool path when provider supports it (fallback to text protocol)
- CustomProvider: full OpenAI-style native tool calling with tool_call/tool result messages
- Per-tool enable/disable (checkboxes) in Agent Profile UI; profile store supports disabledTools
- MCP client: Mcp-Session-Id handling, MCP-Protocol-Version header, improved SSE/JSON and 202/204 handling
- Add OpenAICompatNative helper (OpenAI-style tools/tool_calls/tool results)
- LocalLLM: full native tool-calling support (OpenAI-compatible endpoint)
- OpenAI: native tool-calling overrides (generateWithTools/submitToolResults)
- DeepSeek: native tool-calling overrides (OpenAI-compatible endpoint)
- Grok: native tool-calling overrides (OpenAI-compatible endpoint)
- Agent manager already prefers native tool path when supportsNativeTools() is true
- Anthropic: native tool use/tool_result via Messages API (raw HTTP), structured content blocks, system+agent profile composition
- Gemini: native function calling via Gemini REST generateContent (functionDeclarations/functionCall/functionResponse), avoids SDK version coupling
- Both integrate with AIAgentManager native tool loop and support per-tool/profile toggles
…ntinue-in-inline-lambda)

- DeepSeek/Grok: remove duplicate org.json JSONArray/JSONObject imports
- McpClient/AgentPromptProfile/CustomProviderProfile: replace non-local continue inside ifBlank (requires Kotlin 2.2) with regular if-check for compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant